<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
var countSeniors = function(details) {
    let res = 0;
    let reg = /(?<=[A-Za-z])\d+/;// 利用反向断言获取性别后面的数字
    for (let i = 0; i < details.length; i++) {
        const detail = details[i];
        console.log(detail);
        let num = reg.exec(detail)[0].slice(0,2);// slice(0,2) 取出代表年龄的字段
        console.log(num);
        if(num > 60){
           res++;
        }
    }
    return res;
};
console.log(countSeniors(["7868190130M7522","5303914400F9211","9273338290F4010"]));
  </script>
</body>
</html>